// API 应用程序接口 Application Interface
// fecth axios fastmock
// 取数据 ，api 负责这件事的
// 前端 url get /todos 后端？ /todos 提供todos数据
const todos = [
    // todo
    {
        id: 1,
        text: 'todo1',
        finished: true
    },
    {
        id: 2,
        text: 'todo2',
        finished: false
    },
    {
        id: 3,
        text: 'todo3',
        finished: true
    },
    {
        id: 4,
        text: 'todo4',
        finished: true
    },
    {
        id: 5,
        text: 'todo5',
        finished: false
    },
]
// delay函数
const delay = time => new Promise(rosolve => setTimeout(resolve, time));
// withDelay(function(){}) return async 函数
const withDelay = fn => async (...args) => {
    await delay(1000);
    return fn(...args)
}

// withDelay(function () { })(1, 2, 3)